using System;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PS.WebParts.Rollup.GridViewWebPart
{
    public class DateTimeColumn 
        : FormattedColumn
    {
         internal override string GetFormatedString(object container)
        {
            object value = DataBinder.GetPropertyValue(container, DataField);

            if (String.IsNullOrEmpty(value.ToString()))
            {
                return string.Empty;
            } 
            
            DateTime dt = Convert.ToDateTime(value);
            return dt.ToString(format);
        }

        protected override DataControlField CreateField()
        {
            return new DateTimeColumn();
        }
    }
}
